package com.mew.common.enm;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum GoldProcessType {
    Sign(10, "签到"),
    Friend(20, "好友赠送"),
    Invite(21, "推荐奖励"),
    Days(30, "日领小奖"),
    DaysB(31, "日领大奖"),
    DaysR(32, "日领转盘"),
    Buy(41, "购买"),  // 钻石买金币【钻石转成金币】
    VIPUp(42, "VIP升级"),
    Tran(43, "交易"), // 后台 运营转帐； vip3 转账
    HouTai(44, "后台"), //直接
    GameGift(45, "游戏送礼"),
    ChessRoomCost(46, "棋牌房费"),
    ThirdRegister(47, "第三方注册"),
    Operate(48, "运维赠送"), // 送 小东西
    ChatSendInfo(49,"聊天室发送消息扣除"),
    Recall (50,"邮件撤回"),
    Jewe (51,"购买砖石"),
    AgentBind(52,"代理绑定赠送"),
    AgentProxyLevelChange(53,"被代理玩家升级赠送"),
    AgentExtract(54,"代理提取"),
    Recharge(56,"上分"),
    Redeem(57,"下分"),
    ;

    private final static Map<Integer, GoldProcessType> stateMap
            = Arrays.stream(GoldProcessType.values()).collect(Collectors.toMap(GoldProcessType::code, code -> code));

    private final int code;
    private final String desc;

    /**
     * @param code 代码
     * @param desc 描述
     */
    GoldProcessType(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }
    public String desc() {
        return this.desc;
    }

    /**
     * @param code 代码
     * @return 转换出来的状态码
     */
    public static GoldProcessType parse(int code) {
        return stateMap.get(code);
    }

}
